<template>
  <the-table :columns="columns" uri="/a/balances">
    <span
      slot="balance"
      slot-scope="{ row }"
      :class="row.type == 'in' ? 'blue' : 'red'"
      >{{ row.type == 'in' ? '+' : '-' }} {{ row.value }}</span
    >
  </the-table>
</template>
<script>
import theTable from '@/components/theTable.vue'

const columns = [
  {
    title: 'ID',
    dataIndex: 'id',
  },
  {
    title: '用户名',
    dataIndex: 'member.username',
  },
  {
    title: '类型',
    dataIndex: 'type',
  },
  {
    title: '变化值',
    dataIndex: 'value',
    scopedSlots: { customRender: 'balance' },
  },
  {
    title: '变化前',
    dataIndex: 'b4',
  },
  {
    title: '变化后',
    dataIndex: 'after',
  },
  {
    title: '创建时间',
    dataIndex: 'created_at',
  },
  {
    title: '订单号',
    dataIndex: 'order_id',
  },
]

export default {
  components: { theTable },

  data() {
    return {
      columns,
    }
  },
  mounted() {},
  methods: {},
}
</script>
